import cloud from '@/common/cloud_init.js'

const get = (code = {}) => {
  return new Promise((resolve, reject) => {
    try {
      let res = cloud.callFunction({
        name: 'code',
        data: {
          action: 'get',
          code
        }
      });
      resolve(res);
    } catch (err) {
      reject(err)
    }

  })
}
const adjoin = (code = {}) => {
  return new Promise((resolve, reject) => {
    try {
      let res = cloud.callFunction({
        name: 'code',
        data: {
          action: 'adjoin',
          code
        }
      });
      resolve(res);
    } catch (err) {
      reject(err)
    }
  })
}
export default {
  get,
  adjoin
}
